package com.bookshop.promotion.logic;

import java.util.Date;
import java.util.TimerTask;

import com.bookshop.user.logic.UserManagement;

public class SendCouponsTask extends TimerTask{

	@Override
	public void run() {
		PromotionManagement promotionManagement = new PromotionManagement();
		PromotionItem[] promotionItems = promotionManagement.searchDate(new Date());
		UserManagement userManagement = new UserManagement();
		for (int i = 0; i < promotionItems.length; i++) {
			userManagement.sendCoupons(promotionItems[i].mCreditsMin,promotionItems[i].mCreditsMax,
					promotionItems[i].mEqualCoupons,promotionItems[i].mDiscountCoupons);
		}
	}
}
